﻿<UserControl x:Class="CompareMultiple.Plugin.CompareMultipleImagesView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:y="clr-namespace:WpfImageDuplicates;assembly=WpfImageDuplicates"
             xmlns:local="clr-namespace:CompareMultiple.Plugin"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d">
    <UserControl.CommandBindings>
        <CommandBinding Command="{x:Static local:CompareMultipleImagesView.FindSimilarCommand}" Executed="FindSimilar"/>
    </UserControl.CommandBindings>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="20"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Orientation="Horizontal">
            <Button x:Name="findSimilar" Command="{x:Static local:CompareMultipleImagesView.FindSimilarCommand}"  Content="Find Similar"/>
            <TextBlock Text="Width: "/>
            <TextBox x:Name="txtWidth" MinWidth="100" />
            <TextBlock Text="Height: "/>
            <TextBox x:Name="txtHeight" MinWidth="100" />
            <Button x:Name="btnNewWidthHeight" Click="btnNewWidthHeight_Click" Content="Set"/>
            <Button x:Name="btnShowInNewWindow" Content="Show in New Window" Click="btnShowInNewWindow_Click"/>
            <Button x:Name="btnNextGroup" Content="Next Duplicate Group" Click="btnNextGroup_Click" />
            <TextBlock x:Name="currentGroupName" Margin="20,0,20,0" FontSize="10" FontWeight="Bold"/>
        </StackPanel>
        <ListBox Grid.Row="1" Name="lstItems" ItemsSource="{Binding}" SelectionMode="Extended" Loaded="lstItems_Loaded" SelectionChanged="lstItems_SelectionChanged"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible" Padding="1,1,1,1">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel x:Name="wrap" Loaded="wrap_Loaded" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible" />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Border Margin="2,2,2,2" BorderBrush="Black" BorderThickness="1,1,1,1" HorizontalAlignment="Stretch">
                        <Grid HorizontalAlignment="Stretch">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <y:BasicImageInfoView x:Name="basicInfo" Height="Auto" FileImageViewModel="{Binding}" HorizontalAlignment="Stretch" Tag="{Binding}" Loaded="basicInfo_Loaded"/>                            
                            <Border Grid.Row="1" x:Name="imageBorder">
                                <y:ImageControl Loaded="imgMain1_Loaded" Tag="{Binding}" FileImageViewModel="{Binding}" x:Name="imgMain1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto"
                                       MouseRightButtonDown="imgMain1_MouseRightButtonDown" />
                            </Border>
                                <y:ThumbViewCommandBar SingleDeleteOnly="True" HorizontalAlignment="Right" VerticalAlignment="Top" Width="18" x:Name="thumbCommand" FileImageViewModel="{Binding}" Grid.Row="2"/>
                                <!--RequestDelete="thumbCommand_RequestDelete"
                                                   RequestResize="thumbCommand_RequestResize"
                                                   RequestResizeDelete="thumbCommand_RequestResizeDelete"
                                                   RequestRotate="thumbCommand_RequestRotate"
                                                   />-->
                        </Grid>
                    </Border>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</UserControl>
